package plotterTool;

import java.net.URL;

import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JPanel;

import project.ToolClient;

/**
 * The tool client for the plotter tool.
 * 
 * @author Knut
 */
public class PlotterToolClient extends ToolClient {

	PlotterTool tool;
	
	@Override
	public JPanel init() {
		if (tool == null) {
			tool = new PlotterTool();
		}
		
		return tool.getPanel();
	}

	public String getName() { return "Graftegner"; }
	public String getDescription() { return "Plot enkle grafer"; }
	public int getCategory() { return 2|4; }
	
	public Icon getIcon() {
		URL imageUrl = getClass().getResource("/resources/graph-icon.png");
		if (imageUrl != null) {
			return (Icon)new ImageIcon(imageUrl);
		} else {
			return super.getIcon();
		}
	}

	@Override
	public void stop() {
		tool = null;
	}

}
